package com.zone.session.defaults;

import com.zone.binding.MapperProxyFactory;
import com.zone.binding.MapperRegistry;
import com.zone.session.Configuration;
import com.zone.session.SqlSession;

/**
 * @author: zongzi
 * @description: TODO
 * @date: 2023/11/29
 */
public class DefaultSqlSession implements SqlSession {

    /**
     * 注入映射器注册器，通过该类获取映射器代理
     */
    private Configuration configuration;

    public DefaultSqlSession(Configuration configuration) {
        this.configuration = configuration;
    }


    @Override
    public <T> T selectOne(String statement) {
        // TODO 实现后续补充
        return (T) ("你的类已被代理：" + statement);
    }

    @Override
    public <T> T selectOne(String statement, Object params) {
        // TODO 实现后续补充
        return (T) ("你的类已被代理：" + statement + "参数：" + params);
    }

    @Override
    public <T> T getMapper(Class<T> clazz) {
        return configuration.getMapper(clazz, this);
    }

}
